package com.bosto.jiramanager;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class MainActivity extends Activity implements OnClickListener {
	private Button btn1, btn2,btn3;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		((ApplicationClass)getApplication()).setContext(MainActivity.this);
		initView();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	void initView() {
		btn1 = (Button) findViewById(R.id.btn_add_jira);
		btn2 = (Button) findViewById(R.id.btn_show_jira);
		btn3= (Button) findViewById(R.id.btn_create_db);
		btn1.setOnClickListener(this);
		btn2.setOnClickListener(this);
		btn3.setOnClickListener(this);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.btn_add_jira:
			startActivity(new Intent(MainActivity.this,
					PopAddJiraWinActivity.class));
			break;
		case R.id.btn_show_jira:
			startActivity(new Intent(MainActivity.this, JiraListActivity.class));
			break;
		case R.id.btn_create_db:
			startActivity(new Intent(MainActivity.this, AddDBActivity.class));
			break;
		default:
			break;

		}
	}
}
